//职位管理有内容
import React, { Component } from 'react'
import {
    View,
    Text,
    Image,
    TouchableOpacity,
} from 'react-native';

import { Homec_Style as styles } from '../../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';
import worktime from '../../../util/worktime';
import fmt from '../../../util/fmtDateUtil';
import {common_url} from "../../../util/fetch";

var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;

export default class Selectin_list extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <TouchableOpacity style={styles.manr_allin} activeOpacity={1}
                onPress={() => { this.props.navigation.navigate('Cresume_all', { resumeId: this.props.rowData.resumeId }) }}>

                <View style={[styles.manr_left, { width: width * 0.25 }]}>
                    <Image source={
                        this.props.rowData.resumeIntentField ?
                            {uri: common_url + "uploadImg/" + this.props.rowData.resumeIntentField}
                            : require('../../../img/app/logo.png')} style={styles.head} />
                    <Text style={styles.manr_name}>{this.props.rowData.resumeName}</Text>
                </View>

                <View style={[styles.manr_right, { width: width * 0.75 }]}>

                    <View style={styles.manr_top}>
                        <View style={styles.manr_eve1}>
                            <Text style={styles.manr_pos}>{this.props.rowData.resumeIntentPosition}</Text>
                            <Icon
                                name={'md-female'}
                                size={15}
                                color={'#fc6866'} style={styles.manr_sex} />
                            <Text style={styles.manr_time}>{fmt(this.props.rowData.resumeFlash,'yyyy-MM-dd')}</Text>
                        </View>

                        <View style={styles.manr_eve3}>
                            <Text style={styles.manr_area}>{this.props.rowData.resumeWorkspace}</Text>
                            <Text style={styles.manr_area}>{this._resumeWorkinglife(this.props.rowData.resumeWorkinglife)}年经验</Text>
                            <Text style={styles.manr_area}>
                                {this._xzResumeEducations(this.props.rowData.xzResumeEducations)}
                            </Text>
                        </View>
                    </View>

                    <View style={styles.manr_bottom}>
                        <Text style={styles.manr_botext}>{this._resumeState(this.props.rowData.resumeState)}</Text>
                    </View>
                </View>
            </TouchableOpacity>
        )
    }

    //当前状态
    _resumeState(a) {
        var str = '';
        if (a == '0') {
            str = '未工作';
        } else if (a == '1') {
            str = '在职,考虑新机会';
        } else if (a == '2') {
            str = '离职,正在找工作';
        } else if (a == '3') {
            str = '在职,暂无跳槽打算';
        }
        return str;
    }

    _resumeWorkinglife(data) {                                    //计算时间
        let aa = worktime(data).substring(0, 4);
        let bb = worktime(new Date()).substring(0, 4);
        let sj = bb - aa;                    //页面负责运算计算年龄
        return sj
    }

    _xzResumeEducations(Educations) {
        let arr = '';
        if (Educations != undefined) {
            for (let i = 0; i < Educations.length; i++) {
                if (Educations[i].educationLevel == '博士') {
                    return arr = '博士';
                } else if (Educations[i].educationLevel == '硕士') {
                    return arr = '硕士';
                } else if (Educations[i].educationLevel == '本科') {
                    return arr = '本科';
                } else if (Educations[i].educationLevel == '大专') {
                    return arr = '大专';
                } else if (Educations[i].educationLevel == '中专') {
                    return arr = '中专';
                } else if (Educations[i].educationLevel == '初中') {
                    return arr = '初中';
                }
            }
        } else {
            return arr;
        }
    }

}